package com.mmall.controller;

import com.mmall.common.TokenCache;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.text.MessageFormat;

/**
 * @ClassName: TestController
 * @Title: mmall
 * @Package: com.mmall.controller
 * @Description:
 * @author: liuqingsong
 * @E-mail: lqs_email@163.com
 * @version: 创建时间: 2019/7/20 22:32
 */
@Controller
@RequestMapping("/test/")
@Slf4j
public class TestController {

    @RequestMapping(value="set_cache.do")
    @ResponseBody
    public String setCache(String key,String value){
        TokenCache.setKey(key,value);
        return MessageFormat.format("set key:{0},value:{1}.ok",key,value);
    }

    @RequestMapping(value = "get_cache.do")
    @ResponseBody
    public String getCache(String key){
        return TokenCache.getKey(key);
    }

    @RequestMapping(value = "test.do")
    @ResponseBody
    public String test(String str){
        log.info("tetinfo");
        log.warn("testwarn");
        log.error("testerror");
        return "testValue:"+str;
    }
}
